<%@page import="com.biz.AddressBizImpl"%>
<%@page import="com.entity.Address"%>
<%@page import="com.util.PageBean"%>
<%@page import="com.entity.UserInfo"%>
<%@page import="com.biz.ProductBizImpl"%>
<%@page import="com.entity.Product"%>
<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>地址管理</title>
    
	<meta charset="UTF-8">
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="css/showtable.css">
    <link rel="stylesheet" type="text/css" href="css/modle.css">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		.main-body-div form{
			margin: 0px auto;
			width: 95%;
		}
		
		.main-body-div>form>span{
			margin-right: 10px;
			float: right;
		}
		
		.main-body-div table{
			width: 100%;
		}
		.title-table{
			background-image: linear-gradient(225deg, #D4FFEC 0%, #57F2CC 48%, #4596FB 100%);
			padding: 10px;
			margin-bottom: 0px;
			width: 500px;
			padding-left: 20px;
			border-radius: 25px;
			color: white;
			text-align: left;
		}
	</style>
	<script type="text/javascript">
		function deladdress( delid ){
			if(confirm("你确定要删除吗？")){
				location="user/address?act=del&id="+delid;
			}
		}
	</script>
  </head>
  
  <body class="mybody">
  	<div class="main">
  		<div class="index-title">
  			<iframe src="index-b-elem/header.jsp" frameborder="0" id="title-if"></iframe>
  		</div>
	    <div class="main-body-div">
	    	<form action="" method="post">
	    	<h2 class="title-table">${empty orders?"地址管理":"选择收货地址" }</h2>
	    	<span><a href="user/addAddress.jsp" target="_parent">增加地址</a></span>
	    	<table>
	    		<tr>
	    			<td>编号</td>
	    			<td>联系人</td>
	    			<td>联系电话</td>
	    			<td>国家</td>
	    			<td>省份</td>
	    			<td>城市</td>
	    			<td>县(市)/区</td>
	    			<td>详细地址</td>
	    			<td>操作</td>
	    			<td style="display:${empty orders?'':'none'};">默认地址</td>
	    			<td style="display:${empty orders?'none':''};">选择收货地址</td>
	    		</tr>
	    		<c:forEach items="${adpb.list }" var="myad">
	    		<tr>
	    			<td>${myad.id }</td>
	    			<td>${myad.contacts }</td>
	    			<td>${myad.phone }</td>
	    			<td>${myad.country }</td>
	    			<td>${myad.province }</td>
	    			<td>${myad.city }</td>
	    			<td>${myad.area }</td>
	    			<td>${myad.address }</td>
	    			<td>
	    				<a href="user/address?act=get&id=${myad.id }">修改</a>&nbsp;|&nbsp;
	    				<a href="javascript:deladdress(${myad.id })">删除</a>
	    			</td>
	    			<td style="display:${empty orders?'':'none'};">
	    				<a href="user/address?act=modismain&id=${myad.id }" style="color:${myad.ismain==0?'blue':'red'}">${myad.ismain==0?'设为默认':'默认地址'}</a>
	    			</td>
	    			<td style="display:${empty orders?'none':''};">
	    				<a href="user/orders?act=add&addressid=${myad.id }">提交订单</a>
	    			</td>
	    		</tr>
	    		</c:forEach>
	    	</table>
	    	<p style="text-align:center"> 当前页数:[${adpb.currPage}/${adpb.totalPage}]&nbsp; 
		        <a href="user/address?page=1">首页</a>
		        <a href="user/address?page==${adpb.currPage > 1 ? adpb.currPage-1 : 1}">上一页</a>
		        <a href="user/address?page==${adpb.currPage < adpb.totalPage ? adpb.currPage+1 : adpb.totalPage}">下一页</a> 
		        <a href="user/address?page==${adpb.totalPage}">末页</a>
       		</p>
       	</form>
		</div>
		<div class="index-footer">
  			<iframe src="index-b-elem/footer.jsp" frameborder="0" id="title-if"></iframe>
  		</div>
   	</div>
  </body>
</html>
<jsp:include page="../mybrowse.jsp"></jsp:include>